#include <stdio.h>
#include <string.h>
#include <stdbool.h>

int main()
{
	char A[1000] = {0};
	char Q[1000] = {0};
	int B = 0, R = 0;
	int i = 0, j = 0;
	bool flag = false;

	scanf("%s %d", &A, &B);

	for( ;i < strlen(A);i++){
		R *= 10;
		Q[j++] = (R + A[i] - '0') / B + '0';
		R = (R + A[i] - '0') % B;
	}
	for(i = 0; i < strlen(Q); i++){
		//跳过开头的0
		if(Q[i] == '0' && !flag){ continue; }
		flag = true;
		printf("%c", Q[i]);
	}
	printf(" %d\n", R);
	return 0;
}
	
